package com.huatai.datacenter.controller.panel;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.huatai.dataservice.panel.common.query.ComQuery;
import com.huatai.dataservice.panel.common.query.Query;
import com.huatai.dataservice.panel.common.utils.IpUtils;
import com.huatai.dataservice.panel.feign.PanelClient;
import com.huatai.dataservice.panel.panelModel.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.*;

/**
 * @ClassName PanelDDController
 * @Description TODO
 * @Author luoxc
 * @Date 2023/8/1 11:24
 * @Version 1.0
 */
@Slf4j
@RestController
@RequestMapping("panel")
@Api(tags = "dd静态接口", value = "dd中台静态接口")
public class PanelDDController {

	@Autowired
	private PanelClient panelClient;

	@ApiOperation("阶段信息")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("selectSystemMessage")
	public ResponseVo selectSystemMessage(@RequestBody @Valid ComQuery query) {
		return panelClient.selectSystemMessage(query);
	}

	@ApiOperation("回放-子平台运动")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("selectSubplatformMoveData")
	public ResponseVo selectSubplatformMoveData(@RequestBody @Valid ComQuery query) {
		return panelClient.selectSubplatformMoveData(query);
	}

	@ApiOperation("回放-平台下潜")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("selectPlatformMoveData")
	public ResponseVo selectPlatformMoveData(@RequestBody @Valid ComQuery query) {
		return panelClient.selectPlatformMoveData(query);
	}

	@ApiOperation("回放-模型弹运动")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("selectProductMoveData")
	public ResponseVo selectProductMoveData(@RequestBody @Valid ComQuery query) {
		return panelClient.selectProductMoveData(query);
	}

	@ApiOperation("回放-子平台工作模式")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("selectSubPlatformWorkMode")
	public List<Map<String, Object>> selectSubPlatformWorkMode(@RequestBody @Valid ComQuery query) {
		return panelClient.selectSubPlatformWorkMode(query);
	}

	@ApiOperation("回放-承载平台工作模式")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("selectPlatformWorkMode")
	public List<Map<String, Object>> selectPlatformWorkMode(@RequestBody @Valid ComQuery query) {
		return panelClient.selectPlatformWorkMode(query);
	}

	@ApiOperation("回放-模型弹状态")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("selectProductOperationStatus")
	public ResponseVo selectProductOperationStatus(@RequestBody @Valid ComQuery query) {
		return panelClient.selectProductOperationStatus(query);
	}

	@ApiOperation("回放---选择实验接口")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.taskNumber"
	})
	@PostMapping("/selectTrialInfo")
	public ResponseVo selectTrialInfo(@RequestBody @Valid ComQuery query) {
		return panelClient.selectTrialInfo(query);
	}


	@ApiOperation("回放---发送试验准备指令")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/sendTestPreparation")
	public InstructCommandVo sendTestPreparation(@RequestBody @Valid ComQuery query) {
		return panelClient.sendTestPreparation(query);
	}

	@ApiOperation("回放---发送产品转运指令")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/sendProducttransfer")
	public InstructCommandVo sendProducttransfer(@RequestBody @Valid ComQuery query) {
		return panelClient.sendProducttransfer(query);
	}

	@ApiOperation("回放---发送产品转运动画指令")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/sendProducttransferAnimation")
	public InstructCommandVo sendProducttransferAnimation(@RequestBody @Valid ComQuery query) {
		return panelClient.sendProducttransferAnimation(query);
	}

	@ApiOperation("回放---发送产品装填指令（产品装填）")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/sendProductFilling")
	public InstructCommandVo sendProductFilling(@RequestBody @Valid ComQuery query) {
		return panelClient.sendProductFilling(query);
	}

	@ApiOperation("回放---发送产品装填动画指令（产品装填）")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/sendProductFillingAnimation")
	public InstructCommandVo sendProductFillingAnimation(@RequestBody @Valid ComQuery query) {
		return panelClient.sendProductFillingAnimation(query);
	}

	@ApiOperation("项目信息接口")
	@ApiOperationSupport(order = 0, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/selectProjectInformation")
	public ProjectInformationVo selectProjectInformation(@RequestBody @Valid ComQuery query, HttpServletRequest request) {
		query.getData().setIpAddr(IpUtils.getIpAddr(request));
		return panelClient.selectProjectInformation(query);
	}

	@ApiOperation("项目信息接口（仿真）")
	@ApiOperationSupport(order = 0, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/selectProjectInformationSimulation")
	public ProjectInformationVo selectProjectInformationTwo(@RequestBody @Valid ComQuery query) {
		return panelClient.selectProjectInformationTwo(query);
	}

	@ApiOperation("回放-任务流程接口,根据阶段id查出不同阶段的流程图")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.stageId"
	})
	@PostMapping("/selectTaskFlow")
	public TaskFlowVo selectTaskFlow(@RequestBody @Valid ComQuery query) {
		return panelClient.selectTaskFlow(query);
	}

	@ApiOperation("回放-流程阶段")
	@PostMapping("/selectProcessStage")
	public ResponseVo selectProcessStage() {
		return panelClient.selectProcessStage();
	}


	@ApiOperation("产品基本信息接口(仿真)")
	@ApiOperationSupport(order = 0, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/selectProductInfoSimulation")
	public ResponseVo selectProductInfoSimulation(@RequestBody @Valid ComQuery query) {
		return panelClient.selectProductInfoTwo(query);
	}

	@ApiOperation("产品基本信息接口")
	@ApiOperationSupport(order = 0, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/selectProductInfo")
	public ResponseVo selectProductInfo(@RequestBody @Valid ComQuery query, HttpServletRequest request) {
		query.getData().setIpAddr(IpUtils.getIpAddr(request));
		return panelClient.selectProductInfo(query);
	}

	@ApiOperation("转运车辆信息接口")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/selectTransferCar")
	public TransferCarVo selectTransferCar(@RequestBody @Valid ComQuery query) {
		return panelClient.selectTransferCar(query);
	}

	@ApiOperation("转运车辆实时接口(废弃，暂不使用)")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId",
		"query.data.vehicleId"
	})
	@PostMapping("/selectTransferRealCar")
	public ResponseVo selectTransferRealCar(@RequestBody @Valid ComQuery query) {
		return panelClient.selectTransferRealCar(query);
	}

	@ApiOperation("监控点位接口")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/selectMonitorPoints")
	public ResponseVo selectMonitorPoints(@RequestBody @Valid ComQuery query) {
		return panelClient.selectMonitorPoints(query);
	}

	@ApiOperation("装填设备信息接口")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/selectLoadEquipment")
	public LoadEquipmentVo selectLoadEquipment(@RequestBody @Valid ComQuery query) {
		return panelClient.selectLoadEquipment(query);
	}

	@ApiOperation("浮吊船只信息接口")
	@PostMapping("/selectFloatShip")
	public FloatShipVo selectFloatShip() {
		return panelClient.selectFloatShip();
	}

	@ApiOperation("重力锚信息接口")
	@PostMapping("/selectAnchor")
	public AnchorVo selectAnchor() {
		return panelClient.selectAnchor();
	}

	@ApiOperation("综合保障船只信息接口")
	@PostMapping("/selectShipInfo")
	public ShipInfoVo selectShipInfo() {
		return panelClient.selectShipInfo();
	}

	@ApiOperation("船只实时接口")
	@PostMapping("/selectShipRealInfo")
	public ResponseVo selectShipRealInfo() {
		return panelClient.selectShipRealInfo();
	}

	@ApiOperation("转运阶段视频接口")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId",
		"query.data.stageId"
	})
	@PostMapping("/selectTransportVideo")
	public TransportVideoVo selectTransportVideo(@RequestBody @Valid ComQuery query) {
		return panelClient.selectTransportVideo(query);
	}

	@ApiOperation("事前准备阶段视频接口1")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId",
		"query.data.stageId"
	})
	@PostMapping("/selectPrepareVideoOne")
	public TransportVideoVo selectPrepareVideoOne(@RequestBody @Valid ComQuery query) {
		return panelClient.selectPrepareVideoOne(query);
	}

	@ApiOperation("事前准备阶段视频接口2")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId",
		"query.data.stageId"
	})
	@PostMapping("/selectPrepareVideoTwo")
	public TransportVideoVo selectPrepareVideoTwo(@RequestBody @Valid ComQuery query) {
		return panelClient.selectPrepareVideoTwo(query);
	}

	@ApiOperation("平台就位状态接口（实时）")
	@PostMapping("/selectPlatformStatus")
	public ResponseVo selectPlatformStatus() {
		return panelClient.selectPlatformStatus();
	}

	@ApiOperation("保障系统信息-下拉框接口（实时）")
	@PostMapping("/selectGuaranteeSystem")
	public ResponseVo selectGuaranteeSystem() {
		return panelClient.selectGuaranteeSystem();
	}

	@ApiOperation(" 保障系统信息-列表接口（实时）")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.guarantId"
	})
	@PostMapping("/selectGuaranteeSystemList")
	public ResponseVo selectGuaranteeSystemList(@RequestBody @Valid ComQuery query) {
		return panelClient.selectGuaranteeSystemList(query);
	}

	@ApiOperation("承载平台数据接口（实时）")
	@PostMapping("/selectLoadPlatform")
	public ResponseVo selectLoadPlatform() {
		return panelClient.selectLoadPlatform();
	}

	@ApiOperation("环境接口（实时）")
	@PostMapping("/selectEnvironment")
	public ResponseVo selectEnvironment() {
		return panelClient.selectEnvironment();
	}

	@ApiOperation("模型弹接口（实时）")
	@PostMapping("/selectModelBomb")
	public ResponseVo selectModelBomb() {
		return panelClient.selectModelBomb();
	}


	@ApiOperation("获取吸力锚信息")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/selectSuctionAnchorInfo")
	public ResponseVo selectSuctionAnchorInfo(@RequestBody @Valid ComQuery query) {
		return panelClient.selectSuctionAnchorInfo(query);
	}

	@ApiOperation("获取吸力锚信息（仿真）")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/selectSuctionAnchorInfoSimulation")
	public ResponseVo selectSuctionAnchorInfoSimulation(@RequestBody @Valid ComQuery query) {
		return panelClient.selectSuctionAnchorInfoSimulation(query);
	}


	@ApiOperation("回放---切阶段接口")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/sendCutPhase")
	public CutPhaseVo sendCutPhase(@RequestBody @Valid ComQuery query) {
		return panelClient.sendCutPhase(query);
	}


	@ApiOperation(" 回放---所有动画调用接口")
	@ApiOperationSupport(order = 1, includeParameters = {
		"query.appId",
		"query.data.trialId"
	})
	@PostMapping("/sendAnimation")
	public List<InstructCommandNewVo> sendAnimation(@RequestBody @Valid ComQuery query) {
		return panelClient.sendAnimation(query);
	}


}
